/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ca.ubc.icapture.genapha.beans;

import icapture.SQLMgr;
import icapture.beans.DB.DataRequest;

/**
 *
 * @author btripp
 */
public class DataRequestDecorator extends DataRequest {

    public DataRequestDecorator(DataRequest dr){
        super(dr);
    }
    
    /**
     * @return the approved
     */
    public String getApproved() {
        int approvalCount = SQLMgr.getApprovedCount(super.getRequestId());
        int ownerCount = SQLMgr.getApprovalsNeededCount(super.getRequestId());
        int ownerDeniedCount = SQLMgr.getDeniedApprovalsCount(super.getRequestId());
        if(ownerDeniedCount>0) return "Denied";
        if(approvalCount==ownerCount) return "Approved";
        return approvalCount + "/" + ownerCount;
    }


    public String getSentText() {
        if(super.getSent().booleanValue() == true)
            return "Yes";
        else
            return "No";
    }


}
